import { hrAjax as proFetch } from 'src/hrpub/common/utils/utils';
import moment from 'moment';

export default {
    name: 'emp',
    data: {
        orgValue: null, // 人力资源组织
        widget:false,
        language: {}, // 多语
        context: {}, // 上下文
        pageInfo: {
            pageIndex: 1,
            pageSize: 10,
            total: 0,
            totalPage: 1
        }, // 主页面表格的分页信息
        orderStatus: ['-1', '3'], // 订单状态
        orderTimeRange: 'oneWeek', // 订单时间范围
        orderBeginTime: '', // 订单开始时间
        orderEndTime: '', // 订单结束时间
        page: '', // 当前页面， main主页面，add新增页面，edit修改页面
        tableSelectAll: false, // 是否选中了全部表格
        addPageStatus: 'edit', // 新增页面的状态，edit编辑态，browse浏览态
        offerContentModalVisible: false, // 发送offer弹窗的显示隐藏
        offerModalContent: '', // offer弹窗里的内容字符串
        orgSituationModalVisible: false, // 编制情况弹窗的显示隐藏
        orgStaActiveTab: 'org', // 编制情况的t当前tab
        orgStaOptions: [], // 编制情况里的下拉框内容
        orgStaOrgData: [], // 编制情况的组织编制表格数据
        orgStaDeptData: [], // 编制情况的部门情况表格数据
        orgStaOrgDimension: '', // 编制情况的编制维度
        batchAddModalVisible: false, // 批量新增的弹窗显示隐藏
        batchAddCurrentStep: 0, // 批量新增弹窗当前步骤
        fileManagerModalVisible: false, // 福建管理弹显示显示隐藏
        fileManagerBillId: '', // 传递给福建管理的id
        fromApprove: false, // 是否来自于审批中心的打开
        approveBillType: '', // 审批详情弹窗的billType
        approveBillId: '', // 审批详情弹窗的billId
        approveModalVisible: false, // 审批详情弹窗的显示和隐藏
        showOrgRefer: false, // 是否显示组织参照
        compositedisplay: false, //指派弹窗 是否显示
        compositedata: null, //指派弹窗数据
        compositepostdata: null,//指派弹窗确认事件传到后台数据
        pageHeight: 0, // 获取页面高度
        addPageHistoryData: null, // 卡片页面编辑前数据
        hasSearched: false, // 已经进行过一次查询
        isApprFlow: {}, // true为审批流。false为工作流
        rowOperator:false, //是否显示操作列的详细操作
        rowsDetail:{
            record:{},
            showX:0,
            showY:0,
            index:0,

        },
        pk_wps_def:'', //wps要选择预览的人员
        wpsInitmodelVisible:false,//wps预览框显隐
    },
    sync: {
        update(state, payload) {
            return {
                ...state,
                ...payload
            };
        }
    },
    async: {
         // 校验是审批流还是工作流
        //  checkIsApprFlow(dispatch, getState, payload) {
        //     return proFetch({
        //         url: '/nccloud/hrtrn/pub/CheckIsApprFlowAction.do',
        //         body: payload.postData
        //     })
        // },

        // 获取主页面表格数据
        getMainTableData(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryQueryBillAction.do',
                body: payload.postData
            });
        },
        // 跳转到新增页面前进行验证
        checkToAddPage(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryAddAction.do',
                body: payload.postData
            });
        },
        // 新增页面编辑前
        formEditBefore(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryBeforeEditAction.do',
                body: payload.postData,
                loading: false
            });
        },
        // 删除表格行们
        deleteTableRows(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryDeleteAction.do',
                body: payload.postData
            });
        },
        // 新增表单编辑后
        formEditAfter(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryAfterEditAction.do',
                body: payload.postData,
                loading: false
            });
        },
        // 新增保存
        addPageSave(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntrySaveAction.do',
                body: payload.postData
            });
        },
        // 提交单据
        submitBill(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryCommitAction.do',
                body: payload.postData
            });
        },
         // 执行单据
         excuteBill(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryExcuteAction.do',
                body: payload.postData
            });
        },
        // 收回单据
        callbackBill(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryCallbackAction.do',
                body: payload.postData
            });
        },
        // 修改单据
        editBill(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryEditAction.do',
                body: payload.postData
            });
        },
        // 获取一条数据
        getOneBillData(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryQueryOneAction.do',
                body: payload.postData
            });
        },
        // 复制一条数据
        copyOneBill(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryCopyAction.do',
                body: payload.postData
            });
        },
        // 获取发送offer弹窗内容
        getOfferModalContent(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryGetOfferContentAction.do',
                body: payload.postData
            });
        },
        // 发送offer
        sendOffer(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntrySendOfferAction.do',
                body: payload.postData
            });
        },
        // 接受offer
        acceptOffer(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryAcceptOfferAction.do',
                body: payload.postData
            });
        },
        // 拒绝offer
        rejectOffer(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryRejectOfferAction.do',
                body: payload.postData
            });
        },
        // 提交offer
        submitOffer(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryCommitOfferAction.do',
                body: payload.postData
            });
        },
        // 编制情况打开弹窗获取初始化数据
        getOrgSituationInitData(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryCheckBudgetAction.do',
                body: payload.postData
            });
        },
        // 批量新增页面根据参照选择获取表格数据
        getBatchAddTableDataByRefer(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryBatchAddSelPsnAction.do',
                body: payload.postData
            });
        },
        // 批量新增页面根据查询条件获取表格数据
        getBatchAddTableDataBySearch(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryBatchAddQryPsnAction.do',
                body: payload.postData
            });
        },
        // 批量添加页面第二步表单编辑前
        batchAddModalFormEditBefore(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryBatchAddBeforeEditAction.do',
                body: payload.postData,
                loading: false
            });
        },
        // 批量添加页面第二步表单编辑后
        batchAddModalFormEditAfter(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryBatchAddAfterEditAction.do',
                body: payload.postData,
                loading: false
            });
        },
        // 批量添加页面点击完成
        batchAddModalSubmit(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryBatchAddDoAction.do',
                body: payload.postData
            });
        },
        // 联查人员卡片
        jointPsnCard(dispatch, getState, payload) {
            return proFetch({
                url: '/nccloud/hrhi/psndoc/PsndocCardReptQueryAction.do',
                body: payload.postData
            });
        },
        // 新增取消请求
        cancelAdd(dispatch, getStatem, payload) {
            return proFetch({
                url: '/nccloud/hrtrn/entrymng/EntryCancelAction.do',
                body: payload.postData
            });
        },
        //小部件跳转接口
        getWidgetTableData(dispatch,getState,payload){
            return proFetch({
                url: '/nccloud/hrtrn/widgets/ListData.do',
                body: payload.postData
            })
        }
    }
};